home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / C / Games / NetHack 3.1.3 / source / sys / unix / Makefile.utl < prev    next >
Encoding:
Makefile  |  1993-08-01  |  7.6 KB  |  258 lines  |  [TEXT/R*ch]

  1. #    Makefile for NetHack's utility programs.
  2. #    SCCS Id: @(#)Makefile.utl    3.1    92/11/01
  3.  
  4. # newer makes predefine $(MAKE) to 'make' and do smarter processing of
  5. # recursive make calls if $(MAKE) is used
  6. # these makes allow $(MAKE) to be overridden by the environment if someone
  7. # wants to (or has to) use something other than the standard make, so we do
  8. # not want to unconditionally set $(MAKE) here
  9. #
  10. # unfortunately, some older makes do not predefine $(MAKE); if you have one of
  11. # these, uncomment the following line
  12. # (you will know that you have one if you get complaints about unable to
  13. # execute things like 'foo.o')
  14. # MAKE = make
  15.  
  16. # if you are using gcc as your compiler,
  17. #    uncomment the CC definition below if it's not in your environment
  18. # CC = gcc
  19. #
  20. #    For Bull DPX/2 systems at B.O.S. 2.0 or higher use the following:
  21. #
  22. # CC = gcc -ansi -D_BULL_SOURCE -D_XOPEN_SOURCE -D_POSIX_SOURCE
  23. #    If you are using GCC 2.2.2 or higher on a DPX/2, just use:
  24. #
  25. # CC = gcc -ansi
  26. #
  27. # if your make doesn't define a default SHELL properly, you may need
  28. #    the line below (Atari users will need a bourne work-alike)
  29. # SHELL = /bin/sh
  30.  
  31. # flags may have to be changed as required
  32. # flags for 286 Xenix:
  33. # CFLAGS = -Ml2t16 -O -LARGE -I../include
  34. # LFLAGS = -Ml -F 4000 -SEG 512
  35.  
  36. # flags for 286 Microport SysV-AT
  37. # CFLAGS = -DDUMB -Ml -I../include
  38. # LFLAGS = -Ml
  39.  
  40. # flags for Atari GCC
  41. # CFLAGS = -O -I../include
  42. # LFLAGS = -s
  43.  
  44. # flags for Apollos using their native cc
  45. # (as long as it claims to be __STDC__ but isn't)
  46. # CFLAGS = -DAPOLLO -O -I../include
  47.  
  48. # flags for AIX 3.1 cc on IBM RS/6000 to define
  49. # a suitable subset of standard libraries
  50. # (note that there is more info regarding the "-qchars=signed"
  51. # switch in file Install.unx note 8)
  52. # CFLAGS = -D_NO_PROTO -D_XOPEN_SOURCE -O -I../include -qchars=signed
  53.  
  54. # flags for A/UX 2.01 using native cc or c89
  55. # gcc predefines AUX so that's not needed there
  56. # CFLAGS = -ZS -D_POSIX_SOURCE -O -I../include -DAUX
  57.  
  58. # flags for debugging:
  59. # CFLAGS = -g -I../include
  60.  
  61. CFLAGS = -g -I../include
  62. LFLAGS =
  63.  
  64.  
  65. # yacc/lex programs to use to generate *_comp.h, *_lex.c, and *_yacc.c.
  66. # if, instead of yacc/lex you have bison/flex, comment/uncomment the following.
  67. YACC     = yacc
  68. LEX      = lex
  69. # YACC     = bison -y
  70. # LEX      = flex
  71.  
  72. # these are the names of the output files from YACC/LEX. Under MS-DOS
  73. # and similar systems, they may differ
  74. YTABC = y.tab.c
  75. YTABH = y.tab.h
  76. LEXYYC = lex.yy.c
  77. # YTABC = y_tab.c
  78. # YTABH = y_tab.h
  79. # LEXYYC = lexyy.c
  80.  
  81. # Nothing below this line should have to be changed.
  82.  
  83. # utility .c files
  84. MAKESRC = makedefs.c
  85. SPLEVSRC = lev_yacc.c lev_lex.c lev_main.c panic.c
  86. DGNCOMPSRC = dgn_yacc.c dgn_lex.c dgn_main.c
  87. UTILSRCS = $(MAKESRC) $(SPLEVSRC) $(DGNCOMPSRC)
  88.  
  89. # object files for makedefs
  90. MAKEOBJS = makedefs.o ../src/monst.o ../src/objects.o
  91.  
  92. # object files for special levels compiler
  93. SPLEVOBJS = lev_yacc.o lev_lex.o lev_main.o panic.o \
  94.     ../src/alloc.o ../src/drawing.o ../src/decl.o \
  95.     ../src/monst.o ../src/objects.o
  96.  
  97. # object files for dungeon compiler
  98. DGNCOMPOBJS = dgn_yacc.o dgn_lex.o dgn_main.o panic.o ../src/alloc.o
  99.  
  100. # object files for recovery utility
  101. RECOVOBJS = recover.o
  102.  
  103. # flags for creating distribution versions of sys/share/*_lex.c, using
  104. # a more portable flex skeleton, which is not included in the distribution.
  105. # hopefully keeping this out of the section to be edited will keep too
  106. # many people from being confused by it...
  107. # FLEXDIST = -L -S../sys/share/flexhack.skel
  108. FLEXDIST =
  109. #
  110. # flags for creating distribution versions of sys/share/*_yacc.c, without
  111. # line numbers so patches from version to version are practical
  112. # YACCDIST = -l
  113. YACCDIST =
  114.  
  115.  
  116. #    dependencies for makedefs
  117. #
  118. makedefs:    $(MAKEOBJS)
  119.     $(CC) $(LFLAGS) -o makedefs $(MAKEOBJS)
  120.  
  121. makedefs.o:  ../include/config.h ../include/permonst.h ../include/objclass.h \
  122.         ../include/monsym.h ../include/artilist.h \
  123.         ../include/patchlevel.h ../include/qtext.h
  124.  
  125. ../include/onames.h: makedefs
  126.     ./makedefs -o
  127. ../include/pm.h: makedefs
  128.     ./makedefs -p
  129. ../src/monstr.c: makedefs
  130.     ./makedefs -m
  131. ../include/vis_tab.h: makedefs
  132.     ./makedefs -z
  133. ../src/vis_tab.c: makedefs
  134.     ./makedefs -z
  135.  
  136. lintdefs:
  137.     @lint -axbh -I../include -DLINT $(MAKESRC) ../src/monst.c ../src/objects.c | sed '/_flsbuf/d'
  138.  
  139.  
  140. # the src Makefile is responsible for knowing when to call this, since
  141. # it knows all about the main src and include files
  142. ../include/date.h::
  143.     ./makedefs -v
  144.  
  145.  
  146. #    dependencies for lev_comp
  147. #
  148. lev_comp:  $(SPLEVOBJS)
  149.     $(CC) $(LFLAGS) -o lev_comp $(SPLEVOBJS)
  150.  
  151. lev_yacc.o:  ../include/hack.h ../include/sp_lev.h
  152. lev_main.o:  ../include/hack.h ../include/sp_lev.h ../include/termcap.h
  153. panic.o:     ../include/config.h
  154.  
  155. # see lev_comp.l for WEIRD_LEX discussion
  156. # egrep will return failure if it doesn't find anything, but we know there
  157. # is one "_cplusplus" inside a comment
  158. lev_lex.o:   ../include/hack.h ../include/lev_comp.h ../include/sp_lev.h lev_lex.c
  159.     @echo $(CC) -c $(CFLAGS) lev_lex.c
  160.     @$(CC) -c $(CFLAGS) -DWEIRD_LEX=`egrep -c _cplusplus lev_lex.c` lev_lex.c
  161.  
  162. ../include/lev_comp.h: lev_yacc.c
  163.  
  164. lev_yacc.c: lev_comp.y
  165.     $(YACC) $(YACCDIST) -d lev_comp.y
  166.     mv $(YTABC) lev_yacc.c
  167.     mv $(YTABH) ../include/lev_comp.h
  168.  
  169. lev_lex.c: lev_comp.l
  170.     $(LEX) $(FLEXDIST) lev_comp.l
  171.     mv $(LEXYYC) lev_lex.c
  172.  
  173. # with all of extern.h's functions to complain about, we drown in
  174. # 'defined but not used' without -u
  175. lintlev:
  176.     @lint -axhu -I../include -DLINT $(SPLEVSRC) ../src/alloc.c ../src/monst.c ../src/objects.c | sed '/_flsbuf/d'
  177.  
  178.  
  179. #    dependencies for dgn_comp
  180. #
  181. dgn_comp:  $(DGNCOMPOBJS)
  182.     $(CC) $(LFLAGS) -o dgn_comp $(DGNCOMPOBJS)
  183.  
  184. dgn_yacc.o:  ../include/config.h ../include/dgn_file.h
  185. dgn_main.o:  ../include/config.h
  186.  
  187. # see dgn_comp.l for WEIRD_LEX discussion
  188. dgn_lex.o:   ../include/config.h ../include/dgn_comp.h ../include/dgn_file.h dgn_lex.c
  189.     @echo $(CC) -c $(CFLAGS) dgn_lex.c
  190.     @$(CC) -c $(CFLAGS) -DWEIRD_LEX=`egrep -c _cplusplus dgn_lex.c` dgn_lex.c
  191.  
  192.  
  193. ../include/dgn_comp.h: dgn_yacc.c
  194.  
  195. dgn_yacc.c: dgn_comp.y
  196.     $(YACC) $(YACCDIST) -d dgn_comp.y
  197.     mv $(YTABC) dgn_yacc.c
  198.     mv $(YTABH) ../include/dgn_comp.h
  199.  
  200. dgn_lex.c: dgn_comp.l
  201.     $(LEX) $(FLEXDIST) dgn_comp.l
  202.     mv $(LEXYYC) dgn_lex.c
  203.  
  204. # with all of extern.h's functions to complain about, we drown in
  205. # 'defined but not used' without -u
  206. lintdgn:
  207.     @lint -axhu -I../include -DLINT $(DGNCOMPSRC) panic.c ../src/alloc.c | sed '/_flsbuf/d'
  208.  
  209.  
  210. #    dependencies for recover
  211. #
  212. recover: $(RECOVOBJS)
  213.     $(CC) $(LFLAGS) -o recover $(RECOVOBJS)
  214.  
  215. recover.o: ../include/config.h
  216.  
  217.  
  218.  
  219. # using dependencies like
  220. #    ../src/foo::
  221. #        @( cd ../src ; $(MAKE) foo )
  222. # would always force foo to be up-to-date according to the src Makefile
  223. # when it's needed here.  unfortunately, some makes believe this syntax
  224. # means foo always changes, instead of foo should always be checked.
  225. # therefore, approximate via config.h dependencies, and hope that anybody
  226. # changing anything other than basic configuration also knows when not
  227. # to improvise things not in the instructions, like 'make makedefs' here
  228. # in util...
  229.  
  230. # make sure object files from src are available when needed
  231. #
  232. ../src/alloc.o: ../src/alloc.c ../include/config.h
  233.     @( cd ../src ; $(MAKE) alloc.o )
  234. ../src/drawing.o: ../src/drawing.c ../include/config.h
  235.     @( cd ../src ; $(MAKE) drawing.o )
  236. ../src/decl.o: ../src/decl.c ../include/config.h
  237.     @( cd ../src ; $(MAKE) decl.o )
  238. ../src/monst.o: ../src/monst.c ../include/config.h
  239.     @( cd ../src ; $(MAKE) monst.o )
  240. ../src/objects.o: ../src/objects.c ../include/config.h
  241.     @( cd ../src ; $(MAKE) objects.o )
  242.  
  243. # make sure hack.h dependencies get transitive information
  244. ../include/hack.h: ../include/config.h
  245.     @( cd ../src ; $(MAKE) ../include/hack.h )
  246.  
  247. tags: $(UTILSRCS)
  248.     @ctags -tw $(UTILSRCS)
  249.  
  250. clean:
  251.     rm -f *.o
  252.  
  253. spotless: clean
  254.     rm -f lev_lex.c lev_yacc.c dgn_lex.c dgn_yacc.c
  255.     rm -f ../include/lev_comp.h ../include/dgn_comp.h
  256.     rm -f makedefs lev_comp dgn_comp recover
  257.